import React, { Component } from 'react'
import { NavLink } from 'react-router-dom'
export default class GoodList extends Component {
    constructor() {
        super();
        this.state = {
            goodsList: [
                { name: 'mi11', price: 4999 },
                { name: 'iphone11', price: 8999 },
                { name: 'oppo', price: 4999 }
            ]
        }
    }
    render() {
        let liDom = this.state.goodsList.map(item => {
            return <li key={item.name}><NavLink  to={'/goodsdetail/' + item.name}>{item.name}--￥{item.price}</NavLink></li>
        })
        return (
            <div>
                <ul>
                    {liDom}
                </ul>
            </div>
        )
    }
}
